package collection;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

public class CollectionToArray {
    public static void main(String[] args) {

        Collection<String> c=new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c);
 // 将集合转换为数组，若参数数组元素个数>集合元素个数，多几个补几个默认值
        String[] arr=c.toArray(new String[0]);
        System.out.println(Arrays.toString(arr));


    }
}
